package android.slc.base.ui

import android.slc.box.core.launcher.StageLauncherConfigImpl
import javafx.scene.image.Image
import javafx.stage.Modality
import javafx.stage.Stage
import javafx.stage.StageStyle

open class AppStageLauncherConfigSimple : StageLauncherConfigImpl(), AppStageLauncherConfig {

    companion object {

        fun newInstance(): AppStageLauncherConfig {
            return AppStageLauncherConfigSimple()
        }

        fun newInstanceOwnerFrom(): AppStageLauncherConfig {
            return object : AppStageLauncherConfigSimple() {
                override fun initStage(ownerStage: Stage?, currentStage: Stage) {
                    super.initStage(ownerStage, currentStage)
                    currentStage.initOwner(ownerStage)
                    currentStage.initModality(Modality.WINDOW_MODAL)
                }
            }
        }

        fun newInstanceUndecorated(): AppStageLauncherConfig {
            return object : AppStageLauncherConfigSimple() {
                override fun initStage(ownerStage: Stage?, currentStage: Stage) {
                    super.initStage(ownerStage, currentStage)
                    currentStage.initStyle(StageStyle.UNDECORATED)
                }
            }
        }

    }

    override fun initStage(ownerStage: Stage?, currentStage: Stage) {
        super<StageLauncherConfigImpl>.initStage(ownerStage, currentStage)
        currentStage.icons.add(Image("images/bfxapp.png"))
    }

    override fun setStageParamsRunLast(currentStage: Stage) {
        super<StageLauncherConfigImpl>.setStageParamsRunLast(currentStage)
        currentStage.centerOnScreen()
    }

    override fun createCurrentStage(): Stage {
        return Stage()
    }

}
